package com.sline.wrap;

public class Demo1_wrap {
    public static void main(String[] args) {
        HeimaStudent hs = new HeimaStudent(new Student());
        hs.code();
    }
}

interface Coder {
    public void code();
}

class Student implements Coder {
    @Override
    public void code() {
        System.out.println("javase");
        System.out.println("javaweb");
    }
}

class HeimaStudent implements Coder {
    /*
    * 装饰设计模式
    * 1. 获取被装饰类的引用
    * 2. 在构造方法中传入被装饰类的对象
    * 3. 对原有功能进行升级*/
    private Student s;

    public HeimaStudent(Student s) {
        this.s = s;
    }

    @Override
    public void code() {
        s.code();
        System.out.println("数据库");
        System.out.println("ssh");
        System.out.println("大数据");
        System.out.println("...");
    }
}